<form class="layui-form layui-form-pane" action="{:url()}" method="post" id="editForm">
    <div class="layui-tab-item layui-show layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input field-username" name="name" lay-verify="required" {present name="list.name"}value="{$list['name']}"}{/present} autocomplete="off" placeholder="请输入名称">
            </div>
        </div>
        {if condition="$type neq 1"}
        <div class="layui-form-item">
            <label class="layui-form-label">金额范围</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input field-username" name="price1" lay-verify="required" {present name="list.price1"}value="{$list['price1']}"}{/present} autocomplete="off" placeholder="最少需要红豆币">
            </div>
            <div class="layui-input-inline">
                <input type="text" class="layui-input field-username" name="price2" lay-verify="required" {present name="list.price2"}value="{$list['price2']}"}{/present} autocomplete="off" placeholder="最多需要红豆币">
            </div>
        </div>
        {/if}
    <div class="layui-form-item">
        <div class="layui-input-block">
            {present name="list.id"}
            <input type="hidden" class="field-id" name="id" value="{$list['id']}">
            {/present}
            <input type="hidden" class="field-id" name="type" value="{$type}" ">
            <button type="submit" class="layui-btn layui-btn-normal" lay-submit="" lay-filter="formSubmit">提交</button>
            <a href="{:url('taplist',array('type'=>$type))}" class="layui-btn layui-btn-primary ml10"><i class="aicon ai-fanhui"></i>返回</a>
        </div>
    </div>
</form>
{include file="admin@block/layui" /}
<script src="__ADMIN_JS__/footer.js"></script>

<script>
    /* 修改模式下需要将数据放入此变量 */
    var formData = {:json_encode($data_info)};
    // 会员选择回调函数
    function func(data) {
        var $ = layui.jquery;
        $('input[name="member"]').val('['+data[0]['id']+']'+data[0]['username']);
    }
    layui.use(['upload'], function() {
        var $ = layui.jquery, layer = layui.layer, upload = layui.upload;
        /**
         * 附件上传url参数说明
         * @param string $from 来源
         * @param string $group 附件分组,默认sys[系统]，模块格式：m_模块名，插件：p_插件名
         * @param string $water 水印，参数为空默认调用系统配置，no直接关闭水印，image 图片水印，text文字水印
         * @param string $thumb 缩略图，参数为空默认调用系统配置，no直接关闭缩略图，如需生成 500x500 的缩略图，则 500x500多个规格请用";"隔开
         * @param string $thumb_type 缩略图方式
         * @param string $input 文件表单字段名
         */
        upload.render({
            elem: '.layui-upload'
            ,url: '{:url("admin/annex/upload?water=&thumb=&from=&group=")}'
            ,method: 'post'
            ,before: function(input) {
                layer.msg('文件上传中...', {time:3000000});
            },done: function(res, index, upload) {
                var obj = this.item;
                if (res.code == 0) {
                    layer.msg(res.msg);
                    return false;
                }
                layer.closeAll();
                var input = $(obj).parents('.upload').find('.upload-input');
                if ($(obj).attr('lay-type') == 'image') {
                    input.siblings('img').attr('src', res.data.file).show();
                }
                input.val(res.data.file);
            }
        });
    });
</script>
